<template>
  <div class="header" @click="showDetail">
    <div class="content-wrapper">
      <div class="avatar">
        <img :src="seller.avatar" alt="">
      </div>
      <div class="content">
        <div class="title">
          <span class="brand"></span>
          <span class="name">{{seller.name}}</span> 
        </div>
        <div class="description">
          {{seller.description}}&nbsp;/&nbsp;{{seller.deliveryTime}}分钟送达
        </div>
        <!-- 店铺优惠、优惠等信息 -->
        <div v-if="seller.supports" class="support">
          <support-ico :size="1" :type="0"></support-ico>
          <span class="text">{{seller.supports[0].description}}</span>
        </div>        
      </div>
      <div v-if='seller.supports' class="supports-count">
        <span class="count">{{seller.supports.length}}个</span>
        <i class="icon-keyboard_arrow_right"></i>
      </div>
    </div>
    <div class="bulletin-wrapper">
      <span class="bulletin-title"></span><span class="bulletin-text">{{seller.bulletin}}</span>
      <i class="icon-keyboard_arrow_right"></i>        
    </div>
    <div class="background">
      <img :src="seller.avatar" width="100%" height="100%">
    </div>
  </div>
</template>
<script>
  import supportIcoVue from 'components/support-ico/support-ico';
  export default {
    name: 'v-header',
    // props: ['seller'],
    props: {
      seller: {
        type: Object,
        default() {
          return {}
        }
      }
    },
    methods: {
      showDetail() {
        this.headerDetailComp = this.headerDetailComp || this.$createVHeaderDetail({
        // const instance = this.$createVHeaderDetail({
          $props: {
            seller: 'seller'
          }
        })
        this.headerDetailComp.showMoreDetail()
        // instance.showMoreDetail() // 这表示每次点击，都会重新创建一个instance实例       
      }      
    },
    components: {
      "support-ico": supportIcoVue,      
    }
  }
</script>
<style lang="stylus" scoped>
  @import '~common/stylus/mixin'
  .header
    position relative
    overflow hidden
    color: #fff
    background: rgba(7,17,27,0.5)
    min-width: 320px
    .content-wrapper
      position: relative
      padding: 24px 12px 18px 24px
      font-size: 0
      .avatar
        display: inline-block
        vertical-align: top
        img
          width: 64px
          height: 64px
          border-radius: 2px
      .content
        display: inline-block
        margin-left: 16px
        .title
          margin: 2px 0 8px 0
          .brand
            display: inline-block
            vertical-align: top
            width: 30px
            height: 18px
            bg-image('brand')
            background-size: 30px 18px
            background-repeat: no-repeat
          .name
            margin-left: 6px
            line-height: 18px
            font-size: 16px
            font-weight: bold
        .description
          font-size: 12px
          line-height: 12px
          margin-bottom: 10px
        .support
          .text
            margin-left: 4px
            line-height: 12px
            font-size: 10px
      .supports-count
        position: absolute
        bottom: 18px
        right: 12px
        height 24px
        padding: 0 8px
        background-color: rgba(0,0,0,0.2)
        border-radius: 14px      
        font-size: 10px
        text-align: center
        .count
          vertical-align: middle
          margin-right: 2px
          line-height: 24px
        .icon-keyboard_arrow_right
          line-height: 24px
    .bulletin-wrapper
      position relative
      height 28px
      // line-height 28px
      // width 100%
      padding 0 22px 0 12px
      white-space nowrap
      overflow hidden
      text-overflow ellipsis
      background rgba(7,17,27,0.2)
      .bulletin-title
        display inline-block
        vertical-align top
        margin-top 8px
        height 12px
        width 22px
        bg-image('bulletin')
        background-size 22px 12px
        background-repeat no-repeat
      .bulletin-text
        vertical-align top
        margin 0 4px
        font-size 10px
        line-height 28px
      .icon-keyboard_arrow_right
        position absolute
        top 0
        right 12px
        font-size 10px
        line-height 28px
    .background
      position absolute
      top 0
      left 0
      width 100%
      height 100%
      z-index -1
      filter blur(10px)
</style>
